package com.atguigu.jvm.chap02;

import lombok.Data;


public class ClassLoaderDemo {
    public static void main(String[] args)  {
       /* Object o = new Object();
        System.out.println(o.getClass().getClassLoader());

        System.out.println("=======================");
        System.out.println();
        Fish fish = new Fish();

        System.out.println(fish.getClass().getClassLoader());
        System.out.println(fish.getClass().getClassLoader().getParent());
        System.out.println(fish.getClass().getClassLoader().getParent().getParent());*/
        //int i = 1/0;  //ArithmeticException extends RuntimeException

        //Class.forName("com.mysql.jdbc.Driver222"); //java.lang.ClassNotFoundException
/*
        String t3 = "hello"; //字符串常量池
        String t4 = "hello";

        System.out.println(t3==t4);

        String t1 = new String("hello");
        String t2 = new String("hello");

        System.out.println(t1.equals(t2));*/

        Integer m1 = -129; //  -128 ~ 127  常量池
        Integer m2 = -129;

        System.out.println(m1==m2);
    }
}


@Data
class Fish extends Object{
    //Field
    static  int id = 5;
    String fishName;

/*    <clinit>(){ //类构造器，虚拟机加载类自动生成的，用于调用static{}

    }*/

    Fish(){ //实例构造器

    }

    static {
        id = 10;
    }


    {

    }

    public int eat() {
        String test = fishName;

        return 1;
    }
}